/********************************************************************************
 * Copyright(c) 2020-2025 BST All rights reserved.
 * - Filename
 * - Author
 * - Version V1.0.0
 * - Date    2024/09/9
 * - Brief
 * - FunctionList:
 ******************************************************************************
 * History:
 *
 *
 *
 ******************************************************************************
 */

#pragma once

#include "DhopReplayFrame.pb.h"
#include "vzmq.hpp"

using DetectionCallback =
    std::function<void(const std::shared_ptr<DetectionFrame> &&)>;
class DetectInfoReciver {
 public:
  DetectInfoReciver(void *context);
  ~DetectInfoReciver();
  void start(const std::string &ip, DetectionCallback icb);
  void stop();

 private:
  std::string _ip{"192.168.1.108"};
  vzmq::VzmqContext *_context{nullptr};
  std::shared_ptr<vzmq::VzmqSubscriber<DetectionFrame>> _subscriber;
  bool writeJpegFile(const std::string &filename,
                     const std::vector<unsigned char> &buffer);
};